package com.wtf.dsp.core.constant;

/**
 * ClassName: NsConstant
 * Description: 常量类
 * date: 2023/7/14 17:21
 *
 * @author linhuanyou
 * @version 1.0
 */
public class NsConstant {

    public static final String DEFAULT_NS = "public";

    public static final String NS_DS_GROUP_SPLIT = "_";

    public static final String MAPPER_SQL_SPLIT = ".";

    public static final String _SPLIT = "\\.";

    public static String nsGroupDs(String ns,String ds){
        return new StringBuilder(ns).append(NS_DS_GROUP_SPLIT).append(ds).toString();
    }

    public static String mapperNamespace(String ...ids){
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < ids.length; i++) {
            if(i == ids.length - 1){
                stringBuilder.append(ids[i]);
            } else {
                stringBuilder.append(ids[i]).append(MAPPER_SQL_SPLIT);
            }
        }
        return stringBuilder.toString();
    }

}
